package com.example.mobile2021606159yhf0412;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

import androidx.appcompat.app.AppCompatActivity;

public class p3 extends AppCompatActivity {


    private EditText edtTxtMaina;
    private Button btnMainJisuan;
    private TextView tvMainResult;


    char c1 = 'C';
    char c2 = 'h';
    char c3 = 'i';
    char c4 = 'n';
    char c5 = 'a';

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.p3);
        initView();
    }

    private void initView() {

        edtTxtMaina = (EditText) findViewById(R.id.edtTxtMaina);
        btnMainJisuan = (Button) findViewById(R.id.btnMainJisuan);
        tvMainResult = (TextView) findViewById(R.id.tvMainResult);
    }

    public void resultonClick(View view) {
        String a = edtTxtMaina.getText().toString();
        if (a.equals("China")) {
            c1 += 4;
            c2 += 4;
            c3 += 4;
            c4 += 4;
            c5 += 4;
            char[] arr = {c1, c2, c3, c4, c5};
            tvMainResult.setText(String.valueOf(arr));
        } else if (a.length() == 0) {
            Toast.makeText(p3.this, "请输入字母", Toast.LENGTH_SHORT).show();
        }


//                c1 = (char) (c1 + 4);
//                c2 = (char) (c2 + 4);
//                c3 = (char) (c3 + 4);
//                c4 = (char) (c4 + 4);
//                c5 = (char) (c5 + 4);

    }
}
